useFixture(default)

def test():
	from Modules import commonBits
	java_recorded_version = '1.6.0_17'

	if window('Protocol Buffer Editor'):
		select('FileChooser', commonBits.sampleDir() + 'protoStoreSales3a.bin')
		click('Edit1')
##		select('JTreeTable', '')
		rightclick('JTreeTable', 'Tree,1')
		select_menu('Expand Tree')
##		select('JTreeTable', '')
		rightclick('JTreeTable', 'Tree,2')
		select_menu('Expand Tree')
		select('LayoutCombo', 'Deptartment')
		select('JTreeTable', 'cell:Tree,3(null)')
		assert_p('JTreeTable', 'Text', 'cell:Tree,3(null)')
		select('JTreeTable', 'cell:Tree,8(null)')
		select_menu('Edit>>Copy Record#{s#}')
		select('JTreeTable', 'cell:Tree,4(null)')
		select_menu('Edit>>Paste Record#{s#} Prior')
		select('JTreeTable', 'cell:Tree,4(null)')
		assert_p('JTreeTable', 'Content', '[[, , , ], [, , , ], [, , , ], [, , 335, Department: 335], [, , 957, Department: 957], [, , 410, Department: 410], [, , 620, Department: 620], [, , 878, Department: 878], [, , 929, Department: 929], [, , 957, Department: 957], [, , , ], [, , , ], [, , , ], [, , , ]]')
		select('JTreeTable', 'cell:Tree,4(null)')
		select_menu('Utilities>>Compare with Disk')
		select('JTreeTable', 'cell:Tree,4(null)')
		select('Table', 'cell:keycode,3(62684217)')
		assert_p('Table', 'Content', '[[, , , , , , ], [, Inserted, 39, 957, Department: 957, , ], [, , , , , , ], [, Inserted, 40, 62684217, 40118, 1, 9990], [, , , , , , ], [, Inserted, 41, 64614401, 40118, 1, 1990], [, , , , , , ], [, Inserted, 42, 64614401, 40118, 1, 1990], [, , , , , , ], [, Inserted, 43, 64624770, 40118, 1, 2590], [, , , , , , ], [, Inserted, 44, 4, 16560, 4, ]]')
		select('Table', 'cell:keycode,3(62684217)')
		assert_p('TextPane', 'Text', '')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:Tree,4(null)')
		select('JTreeTable', 'cell:Tree,4(null)')
		select_menu('Window>>protoStoreSales3a.bin>>Tree View')
		select('JTreeTable', 'cell:department,5(410)')
		rightclick('JTreeTable', 'department,4')
		select_menu('Edit Record')
		select('JTreeTable', 'cell:department,5(410)')
		select('Table', 'cell:Data,0(957)')
		select('Table', 'cell:Data,1(Department: 957)')
		assert_p('Table', 'Content', '[[department, 1, , 957, 957], [name, 2, , Department: 957, Department: 957]]')
		select('Table', 'cell:Data,1(Department: 957)')
		click('Save')
		select_menu('Utilities>>Compare with Disk')
		assert_p('TextPane', 'Text', 'Files are Identical !!!')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('Table', 'cell:Data,1(Department: 957)')
		select('Table', 'cell:Data,1(Department: 957)')
		select_menu('Window>>protoStoreSales3a.bin>>Record:')
		select('Table', 'cell:Data,1(Department: 957)')
		click('Delete2')
		select_menu('Window>>protoStoreSales3a.bin>>Tree View')
		select('JTreeTable', 'cell:Tree,4(null)')
		assert_p('JTreeTable', 'Content', '[[, , , ], [, , , ], [, , , ], [, , 335, Department: 335], [, , 410, Department: 410], [, , 620, Department: 620], [, , 878, Department: 878], [, , 929, Department: 929], [, , 957, Department: 957], [, , , ], [, , , ], [, , , ], [, , , ]]')
		select('JTreeTable', 'cell:Tree,4(null)')
		select_menu('Utilities>>Compare with Disk')
		select('JTreeTable', 'cell:Tree,4(null)')
		select('Table', 'cell:keycode,3()')
		assert_p('Table', 'Content', '[[, Deleted, 39, 957, Department: 957, , ], [, , , , , , ], [, Deleted, 40, 62684217, 40118, 1, 9990], [, , , , , , ], [, Deleted, 41, 64614401, 40118, 1, 1990], [, , , , , , ], [, Deleted, 42, 64614401, 40118, 1, 1990], [, , , , , , ], [, Deleted, 43, 64624770, 40118, 1, 2590], [, , , , , , ], [, Deleted, 44, 4, 16560, 4, ], [, , , , , , ]]')
		select('Table', 'cell:keycode,3()')
		assert_p('TextPane', 'Text', '')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:Tree,4(null)')
		select('JTreeTable', 'cell:Tree,4(null)')
		select_menu('Window>>protoStoreSales3a.bin>>Tree View')
		select('JTreeTable', 'cell:Tree,4(null)')
		click('Save')
		select_menu('Utilities>>Compare with Disk')
		assert_p('TextPane', 'Text', 'Files are Identical !!!')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:Tree,4(null)')
	close()
